package com.wang.controller;

import com.wang.entity.Teacher;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Classname TeacherController
 * @Description TODO
 * @Date 2024/5/17 8:44
 * @Created by pc
 */
@RestController
public class TeacherController {

    @RequestMapping("/add")
    public Object add(@RequestBody Teacher teacher){
        System.out.println(teacher);
        return teacher;
    }

    @RequestMapping("/get")
    public Object getList(){
        Teacher t1 = new Teacher("张三",null);
        Teacher t2 = new Teacher("李四",new Date());
        List<Teacher> list = new ArrayList<>();
        list.add(t1);
        list.add(t2);
        return list;
    }
}
